package org.goobs.mapping;



public class IntercityRoad {

	
	private String name;
	private City begin, end;
	private double km;
	
	protected IntercityRoad(String name, City begin, City end, double km){
		this.name = name;
		this.begin = begin;
		this.end = end;
		this.km = km;
	}
	
	public void setBegin(City c){
		begin = c;
	}
	
	public void setEnd(City c){
		end = c;
	}
	
	public void setDistance(double km){
		this.km = km;
	}
	
	public City getBegin(){
		return begin;
	}
	
	public City getEnd(){
		return end;
	}
	
	public double getDistance(){
		return km;
	}
	
	public IntercityRoad reverse(){
		IntercityRoad rtn = new IntercityRoad(name, end, begin, km);
		return rtn;
	}
	
	public String toString(){
		StringBuilder b = new StringBuilder();
		b.append("[").append(km).append("]\t").append(name).append(":\t").append(begin.getName()).append("\t-->\t").append(end.getName());
		return b.toString();
	}
	
}
